{{template "admin/header.html"}}
<title>Login - gpress</title>
<link rel="stylesheet" type="text/css" href="{{basePath}}admin/css/login.css">
<script type="text/javascript" src="{{basePath}}admin/js/sha3.min.js"></script>
</head>
<body>
	<section class="hero is-success is-fullheight">
		<input type="hidden" id="message" value="{{.message}}">
		<div class="hero-body">
			<div class="container has-text-centered">
				<div class="column is-4 is-offset-4">
					<h3 class="title has-text-black">登录</h3>
					<hr class="login-hr">
					<div class="box">

						<figure class="avatar">
							<img src="{{basePath}}public/logo.png">
						</figure>

						<form id="loginForm" action="{{basePath}}admin/login" method="post" onsubmit="return encrypt();">
							<div class="field">
								<div class="control">
									<input class="input is-large" name="account" type="text" placeholder="请输入账号"
										autofocus="">
								</div>
							</div>

							<div class="field">
								<div class="control">
									<input class="input is-large" id="password" name="password" type="password" placeholder="请输入密码">
								</div>
							</div>

							{{ if .showCaptcha }}
							<div class="field has-addons">
								<p class="control">
									<img src="{{ safeURL .captchaBase64 }}" />
								</p>
								<p class="control">
							      <input class="input is-large" id="answer" name="answer" type="text" placeholder="请输入验证码">
								</p>
							</div>
							{{ end }}
                            
							<!--
							<div class="field">
								<label class="checkbox">
									<input type="checkbox">记住我
								</label>
							</div>
							-->

							<button class="button is-success is-large is-fullwidth">登录 <i class="fa fa-sign-in" aria-hidden="true"></i></button>
						</form>
					</div>
					<p class="has-text-grey">
						<!-- <a href="../">注册</a> &nbsp;·&nbsp;-->
						<a href="{{basePath}}admin/chainlogin">区块链登录</a> &nbsp;·&nbsp; 
						<a href="https://gitee.com/gpress/gpress" target="_blank">联系我们</a>
					</p>
				</div>
			</div>
		</div>
	</section>
</body>
<script type="text/javascript">
	function encrypt() {
		document.getElementById('password').value = sha3_512(document.getElementById('password').value);
	}
	$(function() {
		let msg = $('#message').val()
		if (msg) {
			$.confirm({
				useBootstrap: false,
				boxWidth: '400px',
				title: '提示',
				content: msg,
				type: 'red',
				buttons: { '确定': function() {} }
			})
		}
	})
</script>
</html>
